package com.itheima.health.controller.mobile;


import com.itheima.health.common.MessageConst;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.result.Result;
import com.itheima.health.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("mobileSetmealController")
@RequestMapping("/mobile/setmeal")

public class SetmealController {
    //getSetmeal
    @Autowired
    private SetmealService   setmealService;

    @GetMapping("/getSetmeal")
    public Result   getSetmeal(){
        List<Setmeal> setmealList = setmealService.seletAll();
        return  new Result(true,MessageConst.GET_SETMEAL_LIST_SUCCESS,setmealList);

    }
    @GetMapping("/findById")
    public   Result  findById( Integer  id){
    Setmeal setmeal = setmealService.findById(id);
      return   new Result(true,MessageConst.ACTION_SUCCESS,setmeal);

    }
}
